# Maintainer: Andrew Sun <adsun701@gmail.com>

_realname=ruby-dbus
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.23.1
pkgrel=2
pkgdesc="Ruby module for interaction with D-Bus (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/mvidner/ruby-dbus"
msys2_references=(
  'purl: pkg:gem/ruby-dbus'
)
license=('spdx:LGPL-2.1-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-ruby")
source=(https://rubygems.org/downloads/${_realname}-${pkgver}.gem)
noextract=(${_realname}-${pkgver}.gem)
sha256sums=('f582da0a66e7a907dade9473c152194197e322e50771275853ac87b868f1c941')

package() {
  local _gemdir="$(ruby -e 'puts Gem.default_dir')"
  _gemdir="$(cygpath -u ${_gemdir})"
  
  gem install --ignore-dependencies --no-user-install --verbose \
    -i "${pkgdir}/${_gemdir}" -n "${pkgdir}${MINGW_PREFIX}/bin" \
    "${_realname}-${pkgver}.gem"
  
  rm "${pkgdir}/${_gemdir}/cache/${_realname}-${pkgver}.gem"
  
  install -Dm644 "${pkgdir}/${_gemdir}/gems/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
